import { setToken, getToken } from '@/libs/util'

export default {
  state: {
    token:getToken(),
    username:null||localStorage.getItem("username"),
  },
  mutations: {
    setToken(state, token) {
      state.token = token
      setToken(token)
    },
  },
  actions: {
    dosettoken ({ commit }, {token}) {
      commit('setToken', token)
    },
    setuser(state,val){
      state.username = val
      localStorage.setItem("username",val)
    },
  }

}
